package org.dolphin.entity.measurement;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.dolphin.base.constant.DatabaseAttribute;
import org.dolphin.base.constant.Measurement;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "XS_MEASUREMENT", uniqueConstraints = {@UniqueConstraint(columnNames = {"MEASUREMENT"}, name = "UQ_XS_MEASUREMENT_MEASUREMENT")})
public class UnitOfMeasurement implements Serializable {
  private static final long serialVersionUID = -8968328120347566305L;
  private String id;
  private Measurement measurement;
  private String key;
  private String description;

  @Column(name = "DESCRIPTION", length = 255, nullable = false)
  public String getDescription() {
    return description;
  }

  @Id
  @GeneratedValue(generator = "uuid2")
  @GenericGenerator(name = "uuid2", strategy = "org.dolphin.base.id.generator.CustomUUIDGenerator")
  @Column(name = "ID", nullable = false, length = DatabaseAttribute.ID_LENGTH)
  public String getId() {
    return id;
  }

  @Column(name = "RESOURCE_KEY", length = 100, nullable = false)
  public String getKey() {
    return key;
  }

  @Enumerated(EnumType.STRING)
  @Column(name = "MEASUREMENT", length = 100, nullable = false)
  public Measurement getMeasurement() {
    return measurement;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public void setId(String id) {
    this.id = id;
  }

  public void setKey(String key) {
    this.key = key;
  }

  public void setMeasurement(Measurement measurement) {
    this.measurement = measurement;
  }
}
